// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------

export default {
	data() {
		return {
			colorStyle: '',
			navigation: 0,
			colorNum: 0,
			themeColor:''
		};
	},
	created() {
		this.colorStyle = uni.getStorageSync('viewColor')
		// 主题色
		if(this.colorStyle){
			let colorList=this.colorStyle.split(';')
			this.themeColor=(colorList[0].split('--view-theme:')[1]).trim()

			// 排除removePages里面的页面
			let removePages=['pages/annex/special/index']

			// 获取当前页面的栈信息
			const pages = getCurrentPages();
			// 获取数组中最后一个，即当前页面
			const currentPage = pages[pages.length - 1];
			// 获取页面路径
			const pagePath = currentPage.route;

			if(removePages.indexOf(pagePath)===-1){
				// 标题主题色
				uni.setNavigationBarColor({
					frontColor: '#ffffff',
					backgroundColor: this.themeColor,
				})
			}
		}
		uni.$on('ok', data => {
			this.colorStyle = data
		})
		this.navigation = uni.getStorageSync('navigation')
		uni.$on('navOk', data => {
			this.navigation = data
		})
	},
	methods: {
		colorData(){
			this.colorNum = uni.getStorageSync('statusColor')
			uni.$on('colorOk', data => {
				this.colorNum = data
			})
		}
	}
};
